<?php
/**
 * FastApp.
 * 8/13/24
 * @Author 深色的海 (wx:deepsea_0024)
 * @Contact telegram:deepsea159
 */

namespace App\Game\Api\Controller;

use App\Fastapp\Api\Controller\ApiController;
use App\Fastapp\Aspect\ApiAuth;
use App\Game\Api\Service\GameService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Psr\Http\Message\ResponseInterface;

#[Controller('api/game')]
class GameController extends ApiController
{
    #[Inject]
    public GameService $service;

    #[GetMapping('list')]
    public function list(): ResponseInterface
    {
        return $this->success($this->service->list($this->request->all()));
    }

    #[GetMapping('gameNum')]
    public function gameNum(): ResponseInterface
    {
        return $this->success($this->service->gameNum());
    }

    #[GetMapping('categoryRanking')]
    public function categoryRanking(): ResponseInterface
    {
        return $this->success($this->service->categoryRanking());
    }

    #[GetMapping('gameRanking')]
    public function gameRanking(): ResponseInterface
    {
        return $this->success($this->service->gameRanking());
    }

    #[GetMapping('getProvider')]
    public function getProvider(): ResponseInterface
    {
        return $this->success($this->service->getProvider());
    }

    #[GetMapping('detail'), ApiAuth]
    public function detail(): ResponseInterface
    {
        return $this->success($this->service->detail((int)$this->request->input('id')));
    }

    #[GetMapping('bet')]
    public function bet(): ResponseInterface
    {
        return $this->success($this->service->bet($this->request->all()));
    }

    #[GetMapping('logType')]
    public function logType(): ResponseInterface
    {
        return $this->success($this->service->logType());
    }

    #[GetMapping('statistics')]
    public function statistics(): ResponseInterface
    {
        return $this->success($this->service->statistics($this->request->all()));
    }

    #[GetMapping('balance')]
    public function balance(): ResponseInterface
    {
        return $this->success($this->service->balance($this->request->input('symbol')));
    }
}